﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="UI.member.index" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>活动</title>
    <link rel="stylesheet" href="/css/weui.css?v=1">
    <link rel="stylesheet" href="/css/jquery-weui.min.css?v=1">
    <link rel="stylesheet" href="/css/common.css?v=7">
    <link rel="stylesheet" href="/css/example.css?v=7">
    <link rel="stylesheet" href="/css/magiccheck.css?v=7">
    <style>
    .page{z-index:98;}
    </style>
</head>
<body ontouchstart>
<script type="text/html" id="tpl_home">
</script>
<div class="container" id="container"></div>
<div class="weui-tab">
      <div class="weui-tab__bd">
        <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
            <div id="refresh" class="refresh" style="width:100%; height:100%; overflow-y:scroll; -webkit-overflow-scrolling: touch;">
                <div class="weui-pull-to-refresh__layer">
                    <div class='weui-pull-to-refresh__arrow'></div>
                    <div class='weui-pull-to-refresh__preloader'></div>
                    <div class="down">下拉刷新</div>
                    <div class="up">释放刷新</div>
                    <div class="refresh">正在刷新</div>
                </div>
                <div id="layer-table" class="panel" pageindex="1">
                </div>
                <script id="data-table" type="text/html">
                    {{#  layui.each(d, function(index, item){ }}
                    <div class="weui-panel weui-panel_access" onclick="Active_Menu(this,{{item.ID}},{{item.State}},'{{item.Name}}',{{(item.AllMoney-item.TakeMoney)}})" serverid="" img="{{item.Img}}" link="{{item.Link}}" skiplink="{{item.SkipLink}}" mobile="{{item.Mobile}}" context="{{item.Context}}" moneytype="{{item.MoneyType}}" count="{{item.Count}}" onemoney="{{item.OneMoney}}" allmoney="{{item.AllMoney}}" prizetype="{{item.PrizeType}}" range="{{item.Range}}" province="{{item.Province}}" city="{{item.City}}" area="{{item.Area}}" metre="{{item.Metre}}" lat="{{item.Lat}}" lng="{{item.Lng}}" address="{{item.Address}}" degree="{{item.Degree}}" activetype="{{item.ActiveType}}" needcount="{{item.NeedCount}}" giftcount="{{item.GiftCount}}" prizeimg="{{item.PrizeImg}}" weixin="{{item.WeiXin}}" sex="{{item.Sex}}" showover="{{item.ShowOver}}">
                        <div class="weui-panel__hd height20"><div class="a_name">{{item.Name}}</div><div class="a_state">{{item.StateText}}</div><div class="a_arrow"><img src="/img/arrow.png"/></div></div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                {{# if(item.ActiveType==1){}}
                                <div class="a_left"><div class="money">{{item.Count}}</div><div class="title">投放数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">{{item.Count-item.TakeCount}}</div><div class="title">剩余数量</div></div>
                                {{# }else{ }}
                                <div class="a_left"><div class="money">{{item.GiftCount}}</div><div class="title">礼品数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">{{item.GiftCount-item.TakeGiftCount}}</div><div class="title">剩余数量</div></div>
                                {{# } }}
                            </div>
                        </div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                {{# if(item.ActiveType==1){}}
                                <div class="a_left"><div class="money">{{item.AllMoney.toFixed(2)}}</div><div class="title">投放金额</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">{{(item.AllMoney-item.TakeMoney).toFixed(2)}}</div><div class="title">剩余金额</div></div>
                                {{# }else{ }}
                                <div class="a_left"><div class="money">{{item.PraiseCount}}</div><div class="title">点赞数量</div></div>
                                {{# } }}
                            </div>
                        </div>
                        <div class="weui-panel__ft height40">
                            <div class="weui-media-box weui-media-box_text weui-flex padding-top0" style="padding:0px;">
                                <div class="weui-flex__item padding-top10 center"><img src="/img/baoguang.png" style="width:25px;"/>点击次数<font> {{item.ClickCount}}</font></div>
                                <div class="weui-flex__item padding-top10 center"><img src="/img/share.png" style="width:22px;"/>分享次数<font> {{item.ShareCount}}</font></div>
                            </div>
                        </div>
                    </div>
                    {{#  }); }}
                    </script>
                <div id="weui-loadmore" class="weui-loadmore">
                  <i class="weui-loading"></i>
                  <span class="weui-loadmore__tips">正在加载</span>
                </div>
                <div id="nomore" class="nomore hidden">没有更多了</div>
                <div id="nodata" class="nodata hidden">您还没有添加任何活动</div>
            </div>
        </div>
        <div id="tab2" class="weui-tab__bd-item">
          <div id="refresh2" class="refresh" style="width:100%; height:100%; overflow-y:scroll; -webkit-overflow-scrolling: touch;">
                <div class="weui-pull-to-refresh__layer">
                    <div class='weui-pull-to-refresh__arrow'></div>
                    <div class='weui-pull-to-refresh__preloader'></div>
                    <div class="down">下拉刷新</div>
                    <div class="up">释放刷新</div>
                    <div class="refresh">正在刷新</div>
                </div>
                <div id="layer-table2" class="panel" pageindex="1">
                </div>
                <script id="data-table2" type="text/html">
                    <div class="weui-panel weui-panel_access">
                    <div class="weui-panel__bd">
                    {{#  layui.each(d, function(index, item){ }}
                      <a href="javascript:Prev_Image('{{item.Ewm}}?v=1');" class="weui-media-box weui-media-box_appmsg">
                        <div class="weui-media-box__bd">
                          <h4 class="weui-media-box__title">{{item.Name}}</h4>
                          {{# if(item.ActiveType==1){}}
                          <p class="weui-media-box__desc"><div class="smallinfo"><div class="left">{{item.Count}}个</div><div class="right">¥{{item.AllMoney.toFixed(2)}}</div></div></p>
                          {{# }else{ }}
                          <p class="weui-media-box__desc"><div class="smallinfo"><div class="left">{{item.GiftCount}}个</div><div class="right"></div></div></p>
                          {{# } }}
                        </div>
                        <div class="weui-media-box__hd">
                          <img class="weui-media-box__thumb" src="{{item.Ewm}}" alt="">
                        </div>
                      </a>                    
                    {{#  }); }}
                    </div>
                    </div>
                    </script>
                <div id="weui-loadmore2" class="weui-loadmore">
                  <i class="weui-loading"></i>
                  <span class="weui-loadmore__tips">正在加载</span>
                </div>
                <div id="nomore2" class="nomore hidden">没有更多了</div>
                <div id="nodata2" class="nodata hidden">您还没有添加任何活动</div>
            </div>
        </div>
        <div id="tab3" class="weui-tab__bd-item">
            <div id="refresh3" class="refresh" style="width:100%; height:100%; overflow-y:scroll; -webkit-overflow-scrolling: touch;">
                <div class="weui-pull-to-refresh__layer">
                    <div class='weui-pull-to-refresh__arrow'></div>
                    <div class='weui-pull-to-refresh__preloader'></div>
                    <div class="down">下拉刷新</div>
                    <div class="up">释放刷新</div>
                    <div class="refresh">正在刷新</div>
                </div>
                <div class="weidata">
                        <div class="todaydata">&nbsp;&nbsp;今日数据</div>
                        <div class="opencount" id="opencount">0<font> 次</font></div>
                        <div class="opentext">点击次数</div>
                        <div class="otherdata">
                            <div class="left"><div class="top" id="visitcount">0</div><div class="bottom">分享次数</div></div>
                            <div class="middle"><div class="top" id="prizecount">0</div><div class="bottom">领奖人数</div></div>
                            <div class="right"><div class="top" id="money">0.00</div><div class="bottom">今日消费</div></div>
                        </div>
                        <div class="lastdate">&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    </div>
                    <div class="grids-title">&nbsp;&nbsp;&nbsp;微数据</div>
                    <div class="weui-grids" style="z-index:96">
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="width:20%;">日期</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid">点击次数</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid">分享次数</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid">领奖人数</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid">消费金额</a>
                          <div id="layer-table3" class="panel" pageindex="1"></div>
                          <script id="data-table3" type="text/html">
                          {{#  layui.each(d, function(index, item){ }}
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="background:#ffffff;">{{item.Date}}</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="background:#ffffff;">{{item.OpenCount}}</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="background:#ffffff;">{{item.ShareCount}}</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="background:#ffffff;">{{item.PrizeCount}}</a>
                          <a href="javascript:void(0)" class="weui-grid js_grid" style="background:#ffffff; color:#F32A32;">{{item.Money.toFixed(2)}}</a>
                          {{#  }); }}
                          </script>
                    </div>
                </div>
        </div>
        <div id="tab4" class="weui-tab__bd-item">
            <div class="userinfo">
                <div class="headimg"><div class="head"><img src="<%=uinfo.HeadImg %>"/></div><div class="name">&nbsp;&nbsp;<%=uinfo.NickName %><br /> &nbsp;&nbsp;ID:<%=uinfo.ID %></div></div>
                <div class="money">¥<font id="mymoney"><%=uinfo.Money.ToString("0.00") %></font></div>
                <div class="text">账户余额</div>
            </div>
            <div class="weui-cells" style="margin-top:0px;">
                  <a class="weui-cell weui-cell_access" href="javascript:Open_Charge()">
                    <div class="weui-cell__hd"><img src="/img/money.png" alt="" style="width:25px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>充值</p>
                    </div>
                    <div class="weui-cell__ft"></div>
                  </a>
                  <a class="weui-cell weui-cell_access">
                    <div class="weui-cell__hd"><img src="/img/enddate.png" alt="" style="width:25px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>到期时间</p>
                    </div>
                    <div class="weui-cell__ft" style="color:gray; font-size:14px;"><%=uinfo.EndDate.ToString("yyyy-MM-dd") %></div>
                  </a>
                  <!--
                  <a id="userrole" class="weui-cell weui-cell_access" href="javascript:Open_SJPay(<%=uinfo.Role %>)">
                    <div class="weui-cell__hd"><img src="/img/member.png" alt="" style="width:25px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>成为会员</p>
                    </div>
                    <div class="weui-cell__ft"><%if(uinfo.Role==1){ %><font class="reds"><%=config.MemberMoney/100 %>元</font><%}else{ %><font class="reds">已是会员</font><%} %></div>
                  </a>
                  <a class="weui-cell weui-cell_access" href="javascript:Open_Pwd()">
                    <div class="weui-cell__hd"><img src="/img/pwd.png" alt="" style="width:20px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>修改密码</p>
                    </div>
                    <div class="weui-cell__ft"></div>
                  </a>
                  -->
                </div>
                <div class="weui-cells" style="margin-top:10px;">
                  <a class="weui-cell weui-cell_access" href="javascript:Open_KeFu()">
                    <div class="weui-cell__hd"><img src="/img/kefu.png" alt="" style="width:25px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>联系客服</p>
                    </div>
                    <div class="weui-cell__ft"></div>
                  </a>
                  <a class="weui-cell weui-cell_access" href="javascript:About_Us()">
                    <div class="weui-cell__hd"><img src="/img/about.png" alt="" style="width:25px;margin-right:5px;display:block"></div>
                    <div class="weui-cell__bd">
                      <p>关于我们</p>
                    </div>
                    <div class="weui-cell__ft"></div>
                  </a>
                </div>
        </div>
      </div>
      <div class="weui-tabbar" style="z-index:97">
        <a href="#tab1" class="weui-tabbar__item weui-bar__item--on">
          <div class="weui-tabbar__icon">
            <img src="/img/hongbao1.png" oldsrc="/img/hongbao2.png" alt="">
          </div>
          <p id="text" class="weui-tabbar__label">活动</p>
        </a>
        <a href="#tab2" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img src="/img/gift2.png" oldsrc="/img/gift2.png" alt="">
          </div>
          <p class="weui-tabbar__label">码上有礼</p>
        </a>
        <a class="weui-tabbar__item" onclick="Init_Position()" >
           <div class="addactive" id="add_active"><img src="/img/home_add.png"/><p>添加活动</p></div>
        </a>
        <a href="#tab3" class="weui-tabbar__item" onclick="Find_WeiData(null)">
          <div class="weui-tabbar__icon">
            <img src="/img/shuju2.png" oldsrc="/img/shuju2.png" alt="">
          </div>
          <p class="weui-tabbar__label">微数据</p>
        </a>
        <a href="#tab4" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img src="/img/my2.png" oldsrc="/img/my2.png" alt="">
          </div>
          <p class="weui-tabbar__label">我的</p>
        </a>
      </div>
    </div>
   
    <div class="initimg"><img src="/img/hongbao2.png"/><img src="/img/gift1.png"/><img src="/img/shuju1.png"/><img src="/img/my1.png"/></div>
    
</body>
<script src="/js/zepto.min.js"></script>
<script src="/system/layui/layui.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery-weui.js"></script>
<script src="/js/city-picker.js"></script>
<script src="/js/md5.js?v=<%=timestamp %>"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=GGIBZ-I47C3-D6R3K-YE74N-V2TWZ-VBBUC"></script>
<script type="text/javascript" src="/js/example.js"></script>
<script type="text/javascript" src="/js/fastclick.js"></script>
<script type="text/javascript" src="/js/common.js?v=2"></script>
<script>
    var lat = 39.899728, lng = 116.397743;
    var show = true;
    var activetype = 1; //活动类型：1.现金红包活动  2.免费领奖活动
    var userid = "<%=uinfo.ID %>";
    var openid = "<%=uinfo.OpenID %>";
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: 'wx1a4dea3fd54864b9', // 必填，公众号的唯一标识
        timestamp: '<%=timestamp %>', // 必填，生成签名的时间戳
        nonceStr: '<%=noncestr %>', // 必填，生成签名的随机串
        signature: '<%=signature %>', // 必填，签名，见附录1
        jsApiList: [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'onMenuShareQZone',
        "chooseImage",
        "getLocation",
        "openLocation",
        "uploadImage",
        "downloadImage",
        "previewImage",
        "chooseWXPay"
        ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
    
    $(".weui-tabbar a").click(function () {
        var title = $(this).find("p").html();
        document.setTitle(title);
        if (title != "添加活动") {
            var href = $(this).attr("href");
            if (href == "#tab1") {
                $(this).find("img").attr("src", "/img/hongbao1.png");
            }
            else if (href == "#tab2") {
                $(this).find("img").attr("src", "/img/gift1.png");
            }
            else if (href == "#tab3") {
                $(this).find("img").attr("src", "/img/shuju1.png");
            }
            else if (href == "#tab4") {
                $(this).find("img").attr("src", "/img/my1.png");
            }
            var imgs = $(this).siblings().find("img");
            $.each(imgs, function (i, info) {
                $(this).attr("src", $(this).attr("oldsrc"));
            });
        }
    });

    document.setTitle = function (t) {
        document.title = t;
        var i = document.createElement('iframe');
        i.src = '/img/dian.gif';
        i.style.display = 'none';
        i.onload = function () {
            setTimeout(function () {
                i.remove();
            }, 9)
        }
        document.body.appendChild(i);
    }
    $(function () {
        FastClick.attach(document.body);
        $("#add_active").on('click', function () {
                <%if (uinfo.EndDate < DateTime.Now)
          {
        %>
              $.alert("您还不是商家会员或者您的会员已到期",function(){
                window.location.href="/alone.aspx";
              });
              return;
        <% } %>
            $.actions({
                title: "活动类型",
                actions: [{
                    text: "现金红包活动",
                    onClick: function () {
                        activetype = 1;
                        window.pageManager.go("add_active");
                        
                        setTimeout(function () {
                            $("#name").attr("itemid", "0");
                            $("#hongbaorule,#lingjiangtype").removeClass("hidden");
                            $("#lingjiangtype2,#suoxushuliang,#lipinshuliang").addClass("hidden");
                        }, 100);
                    }
                }, {
                    text: "免费领奖活动",
                    onClick: function () {
                        activetype = 2;
                        window.pageManager.go("add_active");
                        
                        setTimeout(function () {
                            $("#name").attr("itemid", "0");
                            $("#hongbaorule,#lingjiangtype").addClass("hidden");
                            $("#lingjiangtype2,#suoxushuliang,#lipinshuliang").removeClass("hidden");
                        }, 100);
                    }
                }]
            });
        });
        $("#refresh").pullToRefresh().on("pull-to-refresh", function () {

            var self = this;
            $("#layer-table").attr("pageindex", "1");
            $("#nomore,#nodata").hide();
            Find_Active(1, function () {
                $(self).pullToRefreshDone();
            });
            show = false;
            setTimeout(function () {
                show = true;
            }, 100);
        });
        $("#refresh").infinite($("#refresh").height() - $(window).height() + 50).on("infinite", function () {
            var self = this;
            if (self.loading) return;
            self.loading = true;
            var pageindex = parseInt($("#layer-table").attr("pageindex")) + 1;
            $("#layer-table").attr("pageindex", pageindex);
            Find_Active(pageindex, function () {
                self.loading = false;
            });
        });
        $("#refresh2").pullToRefresh().on("pull-to-refresh", function () {

            var self = this;
            $("#layer-table2").attr("pageindex", "1");
            $("#nomore2,#nodata2").hide();
            Find_Active2(1, function () {
                $(self).pullToRefreshDone();
            });
            show = false;
            setTimeout(function () {
                show = true;
            }, 100);
        });
        $("#refresh2").infinite($("#refresh2").height() - $(window).height() + 50).on("infinite", function () {
            var self = this;
            if (self.loading) return;
            self.loading = true;
            var pageindex = parseInt($("#layer-table2").attr("pageindex")) + 1;
            $("#layer-table2").attr("pageindex", pageindex);
            Find_Active2(pageindex, function () {
                self.loading = false;
            });
        });
        $("#refresh3").pullToRefresh().on("pull-to-refresh", function () {
            var self = this;
            $("#layer-table3").attr("pageindex", "1");
            Find_WeiData(function () {
                $(self).pullToRefreshDone();
            });
        });
    });
    function Prev_Image(link) {
        if (show) {
            wx.previewImage({
                current: link, // 当前显示图片的http链接
                urls: [link] // 需要预览的图片http链接列表
            });
        }
    };
    function Open_Charge() {
        window.pageManager.go("charge_money");
    };
    function Open_WXPay() {
        
        var data = {};
        data.userid = userid;
        data.openid = openid;
        data.allmoney = parseInt((parseFloat($(".font2").html()) * 100).toFixed(2));
        data.yingfu = parseInt((parseFloat($("#chargemoney").val()) * 100).toFixed(2));
        data.flag = "charge";
        data.act = "GetWxPara";
        if (data.allmoney <= 0 || isNaN(data.allmoney)) {
            $.toast("请输入充值金额", "text");
            return;
        }
        $.showLoading("正在调起支付...");
        Ajax.Post("/tools/API.ashx", data, function (r) {
            $.hideLoading();
            var json = $.parseJSON(r);
            if (json.state) {
                wx.chooseWXPay({
                    appId: json.data.appId,
                    timestamp: json.data.timestamp, // 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
                    nonceStr: json.data.noncestr, // 支付签名随机串，不长于 32 位
                    package: "prepay_id=" + json.data.prepay_id, // 统一支付接口返回的prepay_id参数值，提交格式如：prepay_id=***）
                    signType: 'MD5', // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
                    paySign: json.data.sign, // 支付签名
                    success: function (res) {
                        // 支付成功后的回调函数
                        $("#mymoney").html((parseFloat($("#mymoney").html()) + data.yingfu / 100).toFixed(2));
                        Back();
                        $.toast("支付成功", "text");
                    }
                });
            }
        });
    };
    function Open_SJPay(role) {
        if (role == 2) {
            $.alert("您已经是商家会员了");
            return;
        }
        var data = {};
        data.userid = userid;
        data.openid = openid;
        data.allmoney = "<%=config.MemberMoney %>";
        data.flag = "member";
        data.act = "GetWxPara";
        $.showLoading("正在调起支付...");
        Ajax.Post("/tools/API.ashx", data, function (r) {
            $.hideLoading();
            var json = $.parseJSON(r);
            if (json.state) {
                wx.chooseWXPay({
                    appId: json.data.appId,
                    timestamp: json.data.timestamp, // 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
                    nonceStr: json.data.noncestr, // 支付签名随机串，不长于 32 位
                    package: "prepay_id=" + json.data.prepay_id, // 统一支付接口返回的prepay_id参数值，提交格式如：prepay_id=***）
                    signType: 'MD5', // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
                    paySign: json.data.sign, // 支付签名
                    success: function (res) {
                        // 支付成功后的回调函数
                        $("#mymoney").html((parseFloat($("#mymoney").html()) + parseFloat("<%=config.BackMoney %>") / 100).toFixed(2));
                        $("#userrole .reds").html("已是会员");
                        $("#userrole").attr("href", "javascript:Open_SJPay(2)");
                        $.toast("支付成功", "text");
                    }
                });
            }
        });
    };
    function Open_Pwd() {
        window.pageManager.go("update_pwd");
    };
    function About_Us() {
        window.pageManager.go("about_us");
    };
    function Open_KeFu() {
        window.pageManager.go("kefu");
        setTimeout(function () {
            var data = {};
            data.act = "Find_Kf";
            Ajax.Post("/tools/API.ashx", data, function (r) {
                var json = $.parseJSON(r);
                if (json.state) {
                    Phone_Templete(json.data.list);
                }
            });
        }, 100);
    };
    function Phone_Templete(data) {
        var str = "";
        $.each(data, function (i, info) {
            str += '<a class="weui-cell weui-cell_access" href="tel:'+info.Mobile+'">';
            str += '<div class="weui-cell__bd">';
            str += '<p>' + info.FName + '<br /><font class="kefu_num">' + info.Mobile + '</font></p>';
            str += '</div>';
            str += '<div class="weui-cell__hd"><img src="/img/img_phone.png" alt="" style="width:25px;margin-right:5px;display:block"></div>';
            str += '</a>';
        });
        $("#kefulist").html(str);
    };
    function Update_Pwd() {
        var data = {};
        data.userid = userid;
        data.oldpwd = $("#oldpwd").val();
        data.newpwd = $("#newpwd").val();
        data.surepwd = $("#surepwd").val();
        if (data.oldpwd.Trim()=="") {
            $.toast("原始密码不能为空", "text");
            return;
        }
        if (data.newpwd.Trim() == "") {
            $.toast("新密码不能为空", "text");
            return;
        }
        if (data.surepwd.Trim() == "") {
            $.toast("确认密码不能为空", "text");
            return;
        }
        if (data.newpwd != data.surepwd) {
            $.toast("新密码和确认密码不一致", "text");
            return;
        }
        data.act = "Update_Pwd";
        $.showLoading("请稍后...");
        Ajax.Post("/tools/API.ashx", data, function (r) {
            $.hideLoading();
            var json = $.parseJSON(r);
            $.toast(json.msg, "text");
        });
    };
    function Select_HongBao() {
        window.pageManager.go("select_hongbao");
        setTimeout(function () {
            var type = $("#hongbaoguize").attr("type");
            var count = $("#hongbaoguize").attr("count");
            var money = $("#hongbaoguize").attr("money");
            if (type == "1" || type == "") {
                $("#hong1,#hong2").removeClass("hidden");
                $("#hong3,#hong4").addClass("hidden");
                $("#hong1 .weui-input").val(count);
                $("#hong2 .weui-input").val(money);
                $("#hongbao1").prop("checked", true);
            } else {
                $("#hong1,#hong2").addClass("hidden");
                $("#hong3,#hong4").removeClass("hidden");
                $("#hong3 .weui-input").val(count);
                $("#hong4 .weui-input").val(money);
                $("#hongbao2").prop("checked", true);
            }
        }, 100);

    };
    function Select_HuoDong() {
        window.pageManager.go("add_huodong");
        ischooseimg = false;
        setTimeout(function () {
            $("#context").html($("#activedetail").attr("context"));
            $("#link").val($("#activedetail").attr("link"));
            $("#skiplink").val($("#activedetail").attr("skiplink"));
            $("#mobile").val($("#activedetail").attr("mobile"));
            var img = $("#activedetail").attr("img");
            if (img != "") {
                $(".activeupload").html('<img src="' + img + '">');
                $(".activeupload").attr("serverid", $("#activedetail").attr("serverid"));
            }
            var weixin = $("#activedetail").attr("weixin");
            if (weixin != "") {
                $(".uploadweixin").html('<img src="' + weixin + '"  width="80" height="80">');
                $(".uploadweixin").attr("serverid3", $("#activedetail").attr("serverid3"));
            }
        }, 100);
    };
    function Select_Range() {
        window.pageManager.go("add_range");
        setTimeout(function () {
            var toufangfanwei = $("#toufangfanwei");
            var range = toufangfanwei.attr("range");
            if (range == "1" || range == "") {
                $("#position,#director").addClass("hidden");
                var city = toufangfanwei.attr("city");
                $("#range1").prop("checked", true);
            } else if (range == "2") {
                $("#position,#director").addClass("hidden");
                var city = toufangfanwei.attr("city");
                if (city == "") { city = "请选择"; }
                $("#citys2").html(city);
                $("#range2").prop("checked", true);
            } else if (range == "3") {
                $("#position,#director").addClass("hidden");
                var city = toufangfanwei.attr("city");
                if (city == "") { city = "请选择"; }
                $("#citys3").html(city);
                $("#range3").prop("checked", true);
            } else if (range == "4") {
                $("#position,#director").addClass("hidden");
                var city = toufangfanwei.attr("city");
                if (city == "") { city = "请选择"; }
                $("#citys4").html(city);
                $("#range4").prop("checked", true);
            } else {
                $("#position,#director").removeClass("hidden");
                $("#address").html(toufangfanwei.attr("address")).attr("lat", toufangfanwei.attr("lat")).attr("lng", toufangfanwei.attr("lng"));
                $("#metre").val(toufangfanwei.attr("metre"));
                $("#range5").prop("checked", true);
            }
            var provinces = [];
            $.each($.rawCitiesData, function (i, info) {
                provinces.push(info.name);
            });
            $("#citys2").picker({
                title: "请选择投放的省",
                cols: [
                    {
                        textAlign: 'center',
                        values: provinces
                    }
                ],
                onChange: function (obj) {
                    $("#citys2").html(obj.value);
                }
            });
            $("#citys3").cityPicker({
                title: "请选择投放的市",
                showDistrict: false,
                onChange: function (picker, values, displayValues) {
                    $("#citys3").html(displayValues[0] + "-" + displayValues[1]);
                }
            });
            $("#citys4").cityPicker({
                title: "请选择投放的区",
                onChange: function (picker, values, displayValues) {
                    $("#citys4").html(displayValues[0] + "-" + displayValues[1] + "-" + displayValues[2]);
                }
            });
            $(".selectadd").click(function () {
                var o = this;
                $(this).find("input[name='active_range']").prop("checked", true);
                $("#position,#director").addClass("hidden");
                //必须加上setTimeout，picker才能弹出来
                setTimeout(function () {
                    $("#" + $(o).find(".weui-cell__ft").attr("id")).picker("open");
                }, 10);
            });

        }, 100);
    };
    function Select_ChuanBo() {
        $.actions({
            title: "领奖设置",
            actions: [{
                text: "无需传播，直接领奖",
                onClick: function () {
                    $("#pengyouquan").html("无需传播，直接领奖").attr("prizetype", "1");
                    $("#pipeidu").addClass("hidden");
                }
            }, {
                text: "分享活动详情后领奖",
                onClick: function () {
                    $("#pengyouquan").html("分享活动详情后领奖").attr("prizetype", "2");
                    $("#pipeidu").addClass("hidden");
                }
            }, {
                text: "读取语音文字后领奖",
                onClick: function () {
                    $("#pengyouquan").html("读取语音文字后领奖").attr("prizetype", "3");
                    $("#pipeidu").removeClass("hidden");
                }
            }]
        });

    };
    function Select_LingJiang() {
        $.actions({
            title: "领奖方式",
            actions: [{
                text: "集赞领奖",
                onClick: function () {
                    $("#pengyouquan2").html("集赞领奖").attr("prizetype", "4");

                }
            }, {
                text: "分享领奖",
                onClick: function () {
                    $("#pengyouquan2").html("分享领奖").attr("prizetype", "5");
                }
            }]
        });

    };
    function Select_Sex() {
        $.actions({
            title: "限制性别",
            actions: [{
                text: "不限",
                onClick: function () {
                    $("#sex").html("不限").attr("sex", "0");

                }
            }, {
                text: "男",
                onClick: function () {
                    $("#sex").html("男").attr("sex", "1");
                }
            }, {
                text: "女",
                onClick: function () {
                    $("#sex").html("女").attr("sex", "2");
                }
            }]
        });

    };
    function Select_ShowOver() {
        $.actions({
            title: "结束图提醒",
            actions: [{
                text: "不提醒",
                onClick: function () {
                    $("#showover").html("不提醒").attr("showover", "0");

                }
            }, {
                text: "提醒",
                onClick: function () {
                    $("#showover").html("提醒").attr("showover", "1");
                }
            }]
        });

    };
    function Select_Degree() {
        $.actions({
            title: "匹配度达到该值才能领奖",
            actions: [{
                text: "60%",
                onClick: function () {
                    $("#degree").html("60%");
                }
            }, {
                text: "70%",
                onClick: function () {
                    $("#degree").html("70%");
                }
            }, {
                text: "80%",
                onClick: function () {
                    $("#degree").html("80%");
                }
            }, {
                text: "90%",
                onClick: function () {
                    $("#degree").html("90%");
                }
            }, {
                text: "100%",
                onClick: function () {
                    $("#degree").html("100%");
                }
            }]
        });
    };
    function Active_Menu(o, id, state, name, livemoney) {
        activetype = $(o).attr("activetype");
        var actions = [];
        var edit = {
            text: "编辑",
            onClick: function () {
                if (state == 1) {
                    $.toast("请先暂停活动再编辑", "cancel");
                    return false;
                } else {

                    window.pageManager.go("add_active");
                    setTimeout(function () {
                        $("#hongbaoguize").parent().hide();
                        $("#name").val(name).attr("itemid", id);
                        var moneytype = $(o).attr("moneytype");

                        if (moneytype == "1") {
                            $("#hongbaoguize").attr("type", moneytype).attr("count", $(o).attr("count")).attr("money", $(o).attr("allmoney")).html($(o).attr("count") + "个");
                        } else {
                            $("#hongbaoguize").attr("type", moneytype).attr("count", $(o).attr("count")).attr("money", $(o).attr("onemoney")).html($(o).attr("count") + "个");
                        }
                        $("#activedetail").attr("img", $(o).attr("img")).attr("serverid", "").attr("weixin", $(o).attr("weixin")).attr("serverid3", "").attr("context", $(o).attr("context")).attr("link", $(o).attr("link")).attr("skiplink", $(o).attr("skiplink")).attr("mobile", $(o).attr("mobile"));
                        $("#prizeimg").attr("img", $(o).attr("img")).attr("serverid2", "");
                        $("#activeinfo").html($(o).attr("context").Sub(15));
                        var prizetype = $(o).attr("prizetype");
                        if (prizetype == "1") {
                            $("#pengyouquan").attr("prizetype", prizetype).html("无需传播，直接领奖");
                        } else if (prizetype == "2") {
                            $("#pengyouquan").attr("prizetype", prizetype).html("分享活动详情后领奖");
                        } else if (prizetype == "3") {
                            $("#pengyouquan").attr("prizetype", prizetype).html("读取语音文字后领奖");
                            $("#pipeidu").removeClass("hidden");
                        } else if (prizetype == "4") {
                            $("#pengyouquan2").attr("prizetype", prizetype).html("集赞领奖");
                        } else if (prizetype == "5") {
                            $("#pengyouquan2").attr("prizetype", prizetype).html("分享领奖");
                        }
                        $("#degree").html($(o).attr("degree") + "%");
                        $("#needcount").val($(o).attr("needcount"));
                        $("#giftcount").val($(o).attr("giftcount"));
                        if ($(o).attr("prizeimg") != "" && $(o).attr("prizeimg") != "http://www.mengshen666.cn") {
                            $("#prizeimg").html('<img src="' + $(o).attr("prizeimg") + '" style="width:30px; height:30px; margin-top:5px;">');
                        }
                        if (activetype == "2") {
                            $("#hongbaorule,#lingjiangtype").addClass("hidden");
                            $("#suoxushuliang,#lingjiangtype2,#lingjiangtupian,#lipinshuliang").removeClass("hidden");
                        }
                        var range = $(o).attr("range");
                        var sex = $(o).attr("sex");
                        var showover = $(o).attr("showover");
                        var weizhi = "";
                        if (range == "1") {
                            weizhi = "全国";
                        } else if (range == "2") {
                            weizhi = $(o).attr("province");
                        } else if (range == "3") {
                            weizhi = $(o).attr("province") + "-" + $(o).attr("city");
                        } else if (range == "4") {
                            weizhi = $(o).attr("province") + "-" + $(o).attr("city") + "-" + $(o).attr("area");
                        }
                        if (sex == "1") {
                            $("#sex").html("男").attr("sex", "1");
                        }
                        else if (sex == "2") {
                            $("#sex").html("女").attr("sex", "2");
                        } else {
                            $("#sex").html("不限").attr("sex", "0");
                        }
                        if (showover == "0") {
                            $("#showover").html("不提醒").attr("showover", "0");
                        }
                        else if (showover == "1") {
                            $("#showover").html("提醒").attr("showover", "1");
                        } 
                        $("#toufangfanwei").attr("range", range).attr("city", weizhi).attr("address", $(o).attr("address")).attr("lat", $(o).attr("lat")).attr("lng", $(o).attr("lng")).attr("metre", $(o).attr("metre"));
                        if (range == "5") {
                            $("#toufangfanwei .weui-cell__ft").html($(o).attr("address"));
                        } else {
                            Init_Position();
                            $("#toufangfanwei .weui-cell__ft").html(weizhi);
                        }
                    }, 50);
                }
            }
        };
        var pause = {
            text: "暂停",
            className: "select_pause",
            onClick: function () {
                $.confirm("您确定要暂停活动吗？", function () {
                    var data = {};
                    data.id = id;
                    data.act = "Active_State";
                    data.state = 2;
                    Ajax.Post("/tools/API.ashx", data, function (r) {
                        var json = $.parseJSON(r);
                        if (json.state) {
                            $.toast("暂停成功", "text");
                            //$("#mymoney").html((parseFloat($("#mymoney").html()) + livemoney).toFixed(2));
                            Find_Active(1);
                        } else {
                            $.toast("暂停失败", "text");
                        }
                    });
                });
            }
        };
        var goon = {
            text: "继续",
            className: "select_goon",
            onClick: function () {
                $.confirm("您确定要继续活动吗？", function () {
                    var data = {};
                    data.id = id;
                    data.act = "Active_State";
                    data.state = 1;
                    Ajax.Post("/tools/API.ashx", data, function (r) {
                        var json = $.parseJSON(r);
                        if (json.state) {
                            $.toast("启动成功", "text");
                            //$("#mymoney").html((parseFloat($("#mymoney").html()) - livemoney).toFixed(2));
                            Find_Active(1);
                        } else {
                            $.toast(json.msg, "text");
                        }
                    });
                });
            }
        };
        var deletes = {
            text: "删除",
            className: "select_delete",
            onClick: function () {
                if (state == 1) {
                    $.toast("请先暂停活动再删除", "cancel");
                    return false;
                } else {
                    $.confirm("您确定要删除活动吗？", function () {
                        var data = {};
                        data.id = id;
                        data.act = "Delete_Active";
                        Ajax.Post("/tools/API.ashx", data, function (r) {
                            var json = $.parseJSON(r);
                            if (json.state) {
                                $.toast("删除成功", "text");
                                $("#mymoney").html((parseFloat($("#mymoney").html())+livemoney).toFixed(2));
                                Find_Active(1);
                            } else {
                                $.toast("删除失败", "text");
                            }
                        });
                    });
                }
            }
        };

        var detail = {
            text: "详情",
            onClick: function () {
                window.pageManager.go("handle");
                setTimeout(function () {
                    var data = {};
                    data.sid = id;
                    data.act = "Find_FinsihActive";
                    Ajax.Post("/tools/API.ashx", data, function (r) {
                        var json = $.parseJSON(r);
                        if (json.state) {
                            var str = "";
                            $.each(json.data.list, function (i, info) {
                                str += '<div class="list border-b">';
                                str += '<div class="headimg"><img src="' + info.HeadImg + '"/></div>';
                                str += '<div class="info"><div class="name">' + info.NickName + '</div><div class="lingcount">完成：'+info.LingCount+'</div><div class="date">' + info.CreateDate + '</div><div class="num">编号：' + info.Num + '</div></div>';
                                str += '<div class="handle"><input class="weui-switch" type="checkbox" ' + (info.IsTake == 0 ? '' : 'checked="checked"') + ' onclick="Set_IsTake('+info.ID+')"></div>';
                                str += '</div>';
                            });
                            if (json.data.list.length == 0) {
                                str += '<div class="list">还没有任何人完成任务</div>';
                            }
                            $(".personlist").html(str);

                        } else {
                            $.toast("获取失败", "text");
                        }
                    });
                }, 200);
            }
        };
        if (activetype == 2) {
            actions.push(detail);
        }
        if (state != 3) {
            actions.push(edit);
            if (state == 1) {
                actions.push(pause);
            }
            if (state == 2 || state==4) {
                actions.push(goon);
            }
        }
        
        actions.push(deletes);

        //解决下拉刷新，弹出actionsheet
        if (show) {
            $.actions({
                title: name,
                actions: actions
            });
        }


    };
    function System_Img() {
        $("#systemimg").popup();
    };
    function HongBao_Radio() {
        if ($("input[name='active_hongbao']:checked").val() == "1") {
            $("#hong1,#hong2").removeClass("hidden");
            $("#hong3,#hong4").addClass("hidden");
        } else {
            $("#hong1,#hong2").addClass("hidden");
            $("#hong3,#hong4").removeClass("hidden");
        }
    };
    function Range_Radio() {
        if ($("input[name='active_range']:checked").val() == "5") {
            $("#director,#position").removeClass("hidden");
        } else {
            $("#director,#position").addClass("hidden");
        }
    };
    function Finish_HongBao() {
        var type = $("input[name='active_hongbao']:checked").val();
        if (type == 1) {
            if ($("#hong1 .weui-input").val().Trim() == "" || $("#hong1 .weui-input").val().Trim() == "0") {
                $.toast("请输入红包个数", "text");
                return;
            }
            if ($("#hong2 .weui-input").val().Trim() == "" || $("#hong2 .weui-input").val().Trim() == "0") {
                $.toast("请输入总金额", "text");
                return;
            }
            if (parseFloat($("#hong2 .weui-input").val().Trim()) / parseInt($("#hong1 .weui-input").val().Trim()) < 0.3) {
                $.toast("人均红包金额不能少于0.3元", "text");
                return;
            }
            $("#hongbaoguize").html($("#hong1 .weui-input").val() + "个").attr("count", $("#hong1 .weui-input").val()).attr("type", type).attr("money", $("#hong2 .weui-input").val());
        } else {
            if ($("#hong3 .weui-input").val().Trim() == "" || $("#hong3 .weui-input").val().Trim() == "0") {
                $.toast("请输入红包个数", "text");
                return;
            }
            if ($("#hong4 .weui-input").val().Trim() == "" || $("#hong4 .weui-input").val().Trim() == "0") {
                $.toast("请输入单个金额", "text");
                return;
            }
            if (parseFloat($("#hong4 .weui-input").val().Trim()) < 0.3) {
                $.toast("单个红包金额不能少于0.3元", "text");
                return;
            }
            $("#hongbaoguize").html($("#hong3 .weui-input").val() + "个").attr("count", $("#hong3 .weui-input").val()).attr("type", type).attr("money", $("#hong4 .weui-input").val());
        }
        Back();
    };

    function Init_Position() {
        wx.getLocation({
            type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
            success: function (res) {
                var data = {};
                data.act = "Tran_Position";
                data.lat = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                data.lng = res.longitude; // 经度，浮点数，范围为180 ~ -180。
                lat=res.latitude;
                lng=res.longitude;
                Ajax.Post("/tools/API.ashx", data, function (r) {
                    var json = $.parseJSON(r);
                    lat = json.locations[0].lat;
                    lng = json.locations[0].lng;
                });
            }
        });
    };

    function Open_Map() {
        window.pageManager.go("open_map");
        setTimeout(function () {
            //div容器
            var container = document.getElementById("map");
            var centerDiv = document.getElementById("mapinfo");
            $(container).height($(window).height() * 0.9);
            $(centerDiv).height($(window).height() * 0.1);
            //初始化地图

            var address = $("#address");
            if (address.attr("lat") != "" && parseInt(address.attr("lat")) != 0) {
                lat = parseFloat(address.attr("lat"));
                lng = parseFloat(address.attr("lng"));
            }
            
            var map = new qq.maps.Map(container, {
                // 地图的中心地理坐标
                center: new qq.maps.LatLng(lat, lng),
                zoom: 15,
                zoomControl: false,
                mapTypeControl: false
            });
            //创建自定义控件

            var middleControl = document.createElement("div");
            middleControl.style.left = ($(container).width() / 2 - 10) + "px";
            middleControl.style.top = ($(container).height() / 2 - 35) + "px";
            middleControl.style.position = "relative";
            middleControl.style.width = "36px";
            middleControl.style.height = "36px";
            middleControl.style.zIndex = "100000";
            middleControl.innerHTML = '<img src="/img/1.png" style="height:35px;"/>';
            document.getElementById("map").appendChild(middleControl);
            //返回地图当前中心点地理坐标
            //centerDiv.innerHTML = "latlng:" + map.getCenter();
            var point = (map.getCenter() + "").split(',');
            Position_Address(point[0], point[1]);
            //当地图中心属性更改时触发事件
            qq.maps.event.addListener(map, 'dragend', function () {
                //centerDiv.innerHTML = "latlng:" + map.getCenter();
                point = (map.getCenter() + "").split(',');
                Position_Address(point[0], point[1]);
            });
        }, 10);
    };

    function Position_Address(lats,lngs) {
        var data = {};
        data.act = "Position_Address";
        data.lat = lats; // 纬度，浮点数，范围为90 ~ -90
        data.lng = lngs; // 经度，浮点数，范围为180 ~ -180。
        Ajax.Post("/tools/API.ashx", data, function (r) {
            var json = $.parseJSON(r);
            $("#mapinfo .bigname").html(json.result.formatted_addresses.recommend);
            $("#mapinfo .smallname").html(json.result.address);
            $("#address").html(json.result.formatted_addresses.recommend);
            $("#address").attr("lat", lats).attr("lng", lngs);
        });
    };
    var ischooseimg = false;
    function Choose_Img() {
        wx.chooseImage({
            count: 1, // 默认9
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function (res) {
                var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                $(".activeupload").html('<img src="' + localIds[0] + '">');
                ischooseimg = true;
                wx.uploadImage({
                    localId: $(".activeupload img").attr("src"), // 需要上传的图片的本地ID，由chooseImage接口获得
                    isShowProgressTips: 1, // 默认为1，显示进度提示
                    success: function (res) {
                        var serverId = res.serverId; // 返回图片的服务器端ID
                        $(".activeupload").attr("serverid", serverId);
                    }
                });
            }
        });
    };


    function Choose_WeiXin() {
        wx.chooseImage({
            count: 1, // 默认9
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function (res) {
                var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                $(".uploadweixin").html('<img src="' + localIds[0] + '"  width="80" height="80">');
                wx.uploadImage({
                    localId: $(".uploadweixin img").attr("src"), // 需要上传的图片的本地ID，由chooseImage接口获得
                    isShowProgressTips: 0, // 默认为1，显示进度提示
                    success: function (res) {
                        var serverId = res.serverId; // 返回图片的服务器端ID
                        $(".uploadweixin").attr("serverid3", serverId);
                    }
                });
            }
        });
    };

    function Prize_Img() {
        wx.chooseImage({
            count: 1, // 默认9
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function (res) {
                var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                $("#prizeimg").html('<img src="' + localIds[0] + '" style="width:30px; height:30px; margin-top:5px;">');
                wx.uploadImage({
                    localId: $("#prizeimg img").attr("src"), // 需要上传的图片的本地ID，由chooseImage接口获得
                    isShowProgressTips: 0, // 默认为1，显示进度提示
                    success: function (res) {
                        var serverId = res.serverId; // 返回图片的服务器端ID
                        $("#prizeimg").attr("serverid2", serverId);
                    }
                });
            }
        });
    };
    function Select_Img(src) {
        $(".activeupload").html('<img src="' + src + '">');
        $.closePopup();
    };
    
    function Finish_HuoDong() {
        if ($("#name").attr("itemid")=="0" && $(".activeupload img").length == 0) {
            $.toast("请选择活动图片", "text");
            return;
        }
        if (ischooseimg && $(".activeupload").attr("serverid") == "") {
            $.toast("请等待图片上传完成再点击确定", "text");
            return;
        }
        if ($("#context").val().Trim() == "") {
            $.toast("请输入活动介绍或者语音文字", "text");
            return;
        }
        $("#activedetail").attr("img", $(".activeupload img").attr("src")).attr("weixin", $(".uploadweixin img").attr("src")).attr("context", $("#context").val()).attr("link", $("#link").val()).attr("skiplink", $("#skiplink").val()).attr("mobile", $("#mobile").val());
        $("#activeinfo").html($("#context").val().Sub(15));
        $("#activedetail").attr("serverid", $(".activeupload").attr("serverid")).attr("serverid3", $(".uploadweixin").attr("serverid3"));
        Back();
    };
    function Finish_Range() {
        var range = $("input[name='active_range']:checked").val();
        if (range == "1") {
            $("#toufangfanwei .weui-cell__ft").html("全国");
        }
        else if (range == "2") {
            if ($("#citys2").html() == "请选择") {
                $.toast("请选择投放的省", "text");
                return;
            }
            $("#toufangfanwei").attr("city", $("#citys2").html());
            $("#toufangfanwei .weui-cell__ft").html($("#citys2").html());
        }
        else if (range == "3") {
            if ($("#citys3").html() == "请选择") {
                $.toast("请选择投放的市", "text");
                return;
            }
            $("#toufangfanwei").attr("city", $("#citys3").html());
            $("#toufangfanwei .weui-cell__ft").html($("#citys3").html());
        } else if (range == "4") {
            if ($("#citys4").html() == "请选择") {
                $.toast("请选择投放的区", "text");
                return;
            }
            $("#toufangfanwei").attr("city", $("#citys4").html());
            $("#toufangfanwei .weui-cell__ft").html($("#citys4").html());
        } else {
            if ($("#address").html() == "") {
                $.toast("请选择投放位置", "text");
                return;
            }
            if ($("#metre").val().Trim() == "" || $("#metre").val().Trim() == "0") {
                $.toast("请输入距离", "text");
                return;
            }
            $("#toufangfanwei .weui-cell__ft").html($("#address").html().Sub(15));
            $("#toufangfanwei").attr("address", $("#address").html()).attr("lat", $("#address").attr("lat")).attr("lng", $("#address").attr("lng")).attr("metre", $("#metre").val());
        }
        
        $("#toufangfanwei").attr("range", range);
        Back();
    };
    function Publish() {
        var data = {};
        data.id = $("#name").attr("itemid");
        data.userid = userid;
        data.act = "Save_Active";
        data.name = $("#name").val();
        data.moneytype = $("#hongbaoguize").attr("type");
        data.count = $("#hongbaoguize").attr("count");
        if (data.moneytype == "1") {
            data.allmoney = $("#hongbaoguize").attr("money");
            data.onemoney = parseFloat(data.allmoney) / data.count;
        } else {
            data.onemoney = $("#hongbaoguize").attr("money");
            data.allmoney = parseFloat(data.onemoney) * data.count;
        }
        data.serverid = $("#activedetail").attr("serverid");
        data.serverid2 = $("#prizeimg").attr("serverid2");
        data.serverid3 = $("#activedetail").attr("serverid3");
        data.img = $("#activedetail").attr("img");
        data.prizeimg = $("#prizeimg").attr("img");
        data.weixin = $("#activedetail").attr("weixin");
        data.context = $("#activedetail").attr("context");
        data.link = $("#activedetail").attr("link");
        data.skiplink = $("#activedetail").attr("skiplink");
        data.mobile = $("#activedetail").attr("mobile");
        data.area="";
        if(activetype==1){
            data.prizetype = $("#pengyouquan").attr("prizetype");
        }else{
            data.prizetype = $("#pengyouquan2").attr("prizetype");
        }
        data.range = $("#toufangfanwei").attr("range");
        if (data.range == "1") {
            data.province = "";
            data.city = "";
        } else if (data.range == "2") {
            data.province = $("#toufangfanwei").attr("city");
            data.city = "";
        } else if (data.range == "3") {
            data.province = $("#toufangfanwei").attr("city").split("-")[0];
            data.city = $("#toufangfanwei").attr("city").split("-")[1];
        } else if (data.range == "4") {
            data.province = $("#toufangfanwei").attr("city").split("-")[0];
            data.city = $("#toufangfanwei").attr("city").split("-")[1];
            data.area = $("#toufangfanwei").attr("city").split("-")[2];
        } else {
            data.province = "";
            data.city = "";
            data.area = "";
        }
        data.address = $("#toufangfanwei").attr("address");
        data.lat = $("#toufangfanwei").attr("lat");
        data.lng = $("#toufangfanwei").attr("lng");
        data.metre = $("#toufangfanwei").attr("metre");
        data.degree = $("#degree").html().replace("%", "");
        data.activetype = activetype;
        data.needcount = $("#needcount").val();
        data.giftcount = $("#giftcount").val();
        data.sex = $("#sex").attr("sex");
        data.showover = $("#showover").attr("showover");
        if (data.name.Trim() == "") {
            $.toast("请输入活动名称", "text");
            return;
        }
        if (data.name.length > 25) {
            $.toast("活动名称不能超过25个字", "text");
            return;
        }
        if (activetype == 1) {
            if (data.moneytype == "") {
                $.toast("请选择红包规则", "text");
                return;
            }
            if (data.allmoney / data.count < 0.3) {
                $.toast("人均红包金额不能少于0.3元", "text");
                return;
            }
        } else {
            if (data.needcount == "" || data.needcount == "0") {
                $.toast("请填写所需数量", "text");
                return;
            }
        }
        if (data.context == "") {
            $.toast("请填写活动详情", "text");
            return;
        }
        if (isNaN(data.degree) || data.degree.Trim() == "" || parseInt(data.degree) < 0 || parseInt(data.degree)>100) {
            $.toast("匹配度必须是1-100之间的整数", "text");
            return;
        }
        if (data.range == "") {
            $.toast("请选择投放范围", "text");
            return;
        }
        
        if (data.id == "0") {
            $.showLoading("正在发布...");
        } else {
            $.showLoading("正在保存...");
        }
        console.log(data);
        Ajax.Post("/tools/API.ashx", data, function (r) {
            $.hideLoading();
            var json = $.parseJSON(r);
            if (json.state) {
                Find_Active(1);
                Back();
                if (data.id == "0") {
                    $.toast("发布成功", "text");
                    $("#mymoney").html((parseFloat($("#mymoney").html()) - data.allmoney).toFixed(2));
                } else {
                    $.toast("保存成功", "text");
                }
            } else {
                if (data.id == "0") {
                    $.toast(json.msg, "text");
                } else {
                    $.toast(json.msg, "text");
                }
            }
        });
    };
    function Find_Active(pageindex,fun) {
        var data = {};
        data.act = "Find_Active";
        data.pageindex = pageindex;
        data.userid = userid;
        data.flag = 1;
        //data.sign = GetSign(data.act);
        Ajax.Post("/tools/API.ashx", data, function (r) {
            var json = $.parseJSON(r);
            if (json.state) {
                Pager(json.data.list, pageindex, json.data.count);
                if (fun) { fun(); }
            }
        });
    };
    function Find_Active2(pageindex, fun) {
        var data = {};
        data.act = "Find_Active";
        data.pageindex = pageindex;
        data.userid = userid;
        data.flag = 1;
        //data.sign = GetSign(data.act);
        Ajax.Post("/tools/API.ashx", data, function (r) {
            var json = $.parseJSON(r);
            if (json.state) {
                Pager2(json.data.list, pageindex, json.data.count);
                if (fun) { fun(); }
            }
        });
    };
    Find_Active(1);
    Find_Active2(1);
    function Find_WeiData(fun) {
        var data = {};
        data.act = "Find_WeiData";
        data.userid = userid;
        //data.sign = GetSign(data.act);
        Ajax.Post("/tools/API.ashx", data, function (r) {
            var json = $.parseJSON(r);
            if (json.state) {
                $("#opencount").html(json.data.TodayOpenCount + "<font> 次</font>");
                $("#visitcount").html(json.data.TodayShareCount);
                $("#prizecount").html(json.data.TodayPrizeCount);
                $("#money").html(json.data.TodayMoney.toFixed(2));
                Pager3(json.data.list);
                if (fun) { fun(); }
            }
        });
    };

    function Set_IsTake(id) {
        var data = {};
        data.act = "Set_IsTake";
        data.id = id;
        Ajax.Post("/tools/API.ashx", data, function (r) {
            var json = $.parseJSON(r);
            if (json.state) {
                $.toast(json.msg);
            } else {
                $.toast("取消成功");
            }
        });
    };
    function Back() {
        window.pageManager.back();
    };

    function Pager(data, pageindex, count) {
        layui.use(['laytpl'], function () {
            $ = layui.jquery, laytpl = layui.laytpl;
            var pages = parseInt((count - 1) / 10 + 1);
            laytpl($("#data-table").html()).render(data, function (html) {
                if (pageindex == 1) {
                    $("#layer-table").html(html);
                } else {
                    $("#layer-table").append(html);
                }
            });
            if (pageindex == 1) {
                $("#refresh").infinite();
                $("#weui-loadmore").show();
            }
            if (pageindex == pages || pages == 1) {
                $("#refresh").destroyInfinite();
                $("#weui-loadmore").hide();
                $("#nomore").show();
            }
            if (count == 0) {
                $("#weui-loadmore").hide();
                $("#nodata").show();
            }
        });
    };

    function Pager2(data, pageindex, count) {
        layui.use(['laytpl'], function () {
            $ = layui.jquery, laytpl = layui.laytpl;
            var pages = parseInt((count - 1) / 10 + 1);
            laytpl($("#data-table2").html()).render(data, function (html) {
                if (pageindex == 1) {
                    $("#layer-table2").html(html);
                } else {
                    $("#layer-table2").append(html);
                }

            });
            if (pageindex == 1) {
                $("#refresh2").infinite();
                $("#weui-loadmore2").show();
            }
            if (pageindex == pages || pages == 1) {
                $("#refresh2").destroyInfinite();
                $("#weui-loadmore2").hide();
                $("#nomore2").show();
            }
            if (count == 0) {
                $("#weui-loadmore2").hide();
                $("#nodata2").show();
            }
        });
    };
    function Pager3(data) {
        layui.use(['laytpl'], function () {
            $ = layui.jquery, laytpl = layui.laytpl;
            laytpl($("#data-table3").html()).render(data, function (html) {
                $("#layer-table3").html(html);
            });
        });
    };

    function Update_ChargeMoney(o) {
        var yingfu = parseFloat(isNaN($(o).val()) ? "0" : $(o).val());
        if ($(o).val() == "") {yingfu = 0;}
        var shouxufei = parseFloat($(".font3").html());
        var shifu = yingfu * (1 + shouxufei / 100);
        $(".font2").html(shifu.toFixed(2));
    };
</script>

<script type="text/html" id="tpl_add_active">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_form">
  <!--
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动状态</label></div>
    <div class="weui-cell__bd">
          <div class="float" style="padding-right:20px;">
          <input type="radio" class="magic-radio" name="active_state" id="active_state1" checked="checked" />
          <label for="active_state1">启动</label>
          </div>
          <div class="float" style="font-size:16px;">
          <input type="radio" class="magic-radio" name="active_state" id="active_state2" checked="checked" />
          <label for="active_state2">关闭</label>
          </div>
    </div>
  </div>
  -->
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动名称</label></div>
    <div class="weui-cell__bd">
      <input id="name" itemid="0" class="weui-input" type="text" placeholder="请输入活动名称" style="text-align:right;">
    </div>
  </div>
  <a id="hongbaorule" class="weui-cell weui-cell_access" href="javascript:Select_HongBao()">
      <div class="weui-cell__bd">
           <p>红包规则</p>
      </div>
      <div id="hongbaoguize" class="weui-cell__ft" style="font-size:16px;" type="" count="" money="">请选择</div>
  </a>
  <a id="activedetail" class="weui-cell weui-cell_access" href="javascript:Select_HuoDong()" img="" serverid="" context="" link="" skiplink="" mobile="" weixin="">
      <div class="weui-cell__bd">
           <p>活动详情</p>
      </div>
      <div class="weui-cell__ft" style="font-size:16px;" id="activeinfo">点击进入</div>
  </a>
  <a id="lingjiangtype" class="weui-cell weui-cell_access" href="javascript:Select_ChuanBo()">
      <div class="weui-cell__bd">
           <p>领奖方式</p>
      </div>
      <div id="pengyouquan" prizetype="1" class="weui-cell__ft" style="font-size:16px;">无需传播，直接领奖</div>
  </a>
  <a id="pipeidu" class="weui-cell weui-cell_access hidden" href="javascript:Select_Degree()">
      <div class="weui-cell__bd">
           <p>语音匹配度</p>
      </div>
      <div id="degree" prizetype="1" class="weui-cell__ft" style="font-size:16px;">60%</div>
  </a>
  <a id="lingjiangtype2" class="weui-cell weui-cell_access hidden" href="javascript:Select_LingJiang()">
      <div class="weui-cell__bd">
           <p>领奖方式</p>
      </div>
      <div id="pengyouquan2" prizetype="4" class="weui-cell__ft" style="font-size:16px;">集赞领奖</div>
  </a>
  <div id="suoxushuliang" class="weui-cell hidden">
    <div class="weui-cell__hd"><label class="weui-label">所需数量</label></div>
    <div class="weui-cell__bd">
      <input id="needcount" needcount="0" class="weui-input" type="text" placeholder="请输入所需点赞或分享数量" style="text-align:right;">
    </div>
  </div>
  <div id="lipinshuliang" class="weui-cell hidden">
    <div class="weui-cell__hd"><label class="weui-label">礼品数量</label></div>
    <div class="weui-cell__bd">
      <input id="giftcount" class="weui-input" type="text" placeholder="请输入礼品数量" style="text-align:right;">
    </div>
  </div>
  <!--
  <a id="lingjiangtupian" class="weui-cell weui-cell_access" href="javascript:Prize_Img()">
      <div class="weui-cell__bd">
           <p>领奖图片</p>
      </div>
      <div id="prizeimg" serverid2="" img="" class="weui-cell__ft" style="font-size:16px;">请选择</div>
  </a>
  -->
  <a class="weui-cell weui-cell_access" href="javascript:Select_Sex()">
      <div class="weui-cell__bd">
           <p>限制性别</p>
      </div>
      <div id="sex" sex="0" class="weui-cell__ft" style="font-size:16px;">不限</div>
  </a>
  <a class="weui-cell weui-cell_access" href="javascript:Select_ShowOver()">
      <div class="weui-cell__bd">
           <p>结束图提醒</p>
      </div>
      <div id="showover" showover="0" class="weui-cell__ft" style="font-size:16px;">不提醒</div>
  </a>
  <a id="toufangfanwei" class="weui-cell weui-cell_access" href="javascript:Select_Range()" range="" city="" address="" lat="" lng="" metre="">
      <div class="weui-cell__bd">
           <p>投放范围</p>
      </div>
      <div class="weui-cell__ft" style="font-size:16px;">请选择</div>
  </a>
</div>
<div class="button">
    <a href="javascript:Publish()" class="weui-btn weui-btn_primary">发布</a>
    </div>
</div>
</div>
</script>
<script type="text/html" id="tpl_select_hongbao">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_checkbox">
      <label class="weui-cell weui-check__label" for="hongbao1" onclick="HongBao_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_hongbao" id="hongbao1" checked="checked" value="1"/>
          <label for="hongbao1">随机红包</label>
        </div>
      </label>
      <div id="hong1" class="weui-cell">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;红包个数</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入红包个数" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          个
        </div>
      </div>
      <div id="hong2" class="weui-cell">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总金额</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入总金额" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          元
        </div>
      </div>
      <label class="weui-cell weui-check__label" for="hongbao2" onclick="HongBao_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_hongbao" id="hongbao2" value="2"/>
          <label for="hongbao2">指定红包</label>
        </div>
      </label>
      <div id="hong3" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;红包个数</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入红包个数" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          个
        </div>
      </div>
      <div id="hong4" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单个金额</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入单个金额" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          元
        </div>
      </div>
    </div>
    <div class="button">
    <a href="javascript:Finish_HongBao()" class="weui-btn weui-btn_primary">确定</a>
    </div>
</div>
</div>
</script>
<script type="text/html" id="tpl_add_huodong">
<div class="page">
<div class="page__bd">
<div class="weui-cells">
  <!--
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动名称</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" type="text" placeholder="请输入活动名称">
    </div>
  </div>
  -->
</div>
<div class="weui-cells" style="margin-top:10px;">
  <div class="activeimg"><div class="left">图片</div><div class="right" onclick="System_Img()">系统图片</div></div>
  <div class="activeupload" onclick="Choose_Img()" serverid=""><div class="heng"></div><div class="shu"></div></div>
</div>
<div class="weui-cells" style="margin-top:10px;">
  <div class="activeimg"><div class="left">文字</div></div>
  <div class="activetext"><textarea id="context" placeholder="输入活动介绍或者语音文字"></textarea></div>
</div>
<div class="weui-cells" style="margin-top:10px;">
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">广告链接</label></div>
    <div class="weui-cell__bd">
      <input id="link" itemid="0" class="weui-input" type="text" placeholder="请输入广告链接（非必填）" style="text-align:right;">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">跳转链接</label></div>
    <div class="weui-cell__bd">
      <input id="skiplink" itemid="0" class="weui-input" type="text" placeholder="请输入跳转链接（非必填）" style="text-align:right;">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">联系电话</label></div>
    <div class="weui-cell__bd">
      <input id="mobile" itemid="0" class="weui-input" type="text" placeholder="请输入联系电话（非必填）" style="text-align:right;">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">二维码</label></div>
    <div class="weui-cell__bd" style="text-align:right;">
      <div class="uploadweixin" onclick="Choose_WeiXin()" serverid3=""><img src="/img/add-photo.png" width="80" height="80"/></div>
    </div>
  </div>
</div>
<div class="button" style="margin-bottom:20px;">
    <a href="javascript:Finish_HuoDong()" class="weui-btn weui-btn_primary">确定</a>
</div>
</div>
</div>
</script>
<script type="text/html" id="tpl_add_range">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_checkbox">
      <label class="weui-cell weui-check__label weui-cell_access" for="range1" onclick="Range_Radio();">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range1" checked="checked" value="1"/>
          <label for="range1">全国</label>
        </div>
        <div class="weui-cell__bd"></div>
        <div class="weui-cell__ft"></div>
      </label>
      <div class="weui-cell weui-check__label weui-cell_access selectadd" onclick="Range_Radio();">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range2" checked="checked" value="2"/>
          <label for="range2">选择省</label>
        </div>
        <div class="weui-cell__bd"></div>
        <div class="weui-cell__ft" id="citys2">请选择</div>
      </div>
      <div class="weui-cell weui-check__label weui-cell_access selectadd" onclick="Range_Radio();">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range3" checked="checked" value="3"/>
          <label for="range3">选择市</label>
        </div>
        <div class="weui-cell__bd"></div>
        <div class="weui-cell__ft" id="citys3">请选择</div>
      </div>
      <div class="weui-cell weui-check__label weui-cell_access selectadd" onclick="Range_Radio();">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range4" checked="checked" value="4"/>
          <label for="range4">选择区</label>
        </div>
        <div class="weui-cell__bd"></div>
        <div class="weui-cell__ft" id="citys4">请选择</div>
      </div>
      <label class="weui-cell weui-check__label" for="range5" onclick="Range_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range5" value="5"/>
          <label for="range5">指定范围</label>
        </div>
      </label>
      <div id="position" class="weui-cell weui-cell_access hidden" onclick="Open_Map()">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投放位置</label></div>
        <div class="weui-cell__bd">
        </div>
        <div class="weui-cell__ft" id="address" lat="" lng="">
           请选择
        </div>
      </div>
      <div id="director" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投放半径</label></div>
        <div class="weui-cell__bd">
          <input id="metre" class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入距离" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          米以内
        </div>
      </div>
    </div>
    <div class="button">
    <a href="javascript:Finish_Range()" class="weui-btn weui-btn_primary">确定</a>
    </div>
</div>
</div>
</script>
<script type="text/html" id="tpl_open_map">
<div class="page">
<div class="page__bd">
<div id="map" class="map"></div>
<div id="mapinfo" class="mapinfo">
    <div class="left">
        <div class="bigname">加载中...</div>
        <div class="smallname">加载中...</div>
    </div>
    <div class="right"><div class="buttons" onclick="Back()">确定</div></div>
</div>
</div>
</script>
<script type="text/html" id="tpl_update_pwd">
<div class="page">
<div class="page__bd">
<div class="weui-cells__title">修改密码</div>
    <div class="weui-cells" style="margin-top:0px;">
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">原始密码</label></div>
        <div class="weui-cell__bd">
          <input id="oldpwd" class="weui-input" type="password" pattern="" placeholder="请输入原始密码">
        </div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">新密码</label></div>
        <div class="weui-cell__bd">
          <input id="newpwd" class="weui-input" type="password" pattern="" placeholder="请输入新密码">
        </div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">确认密码</label></div>
        <div class="weui-cell__bd">
          <input id="surepwd" class="weui-input" type="password" pattern="" placeholder="请输入确认密码">
        </div>
      </div>
    </div>
    <div class="button">
    <a href="javascript:Update_Pwd()" class="weui-btn weui-btn_primary">确定</a>
    </div>
</div>
</div>
</script>

<script type="text/html" id="tpl_about_us">
<div class="page">
<div class="page__bd">
<div class="footer">
  <div class="ewm"><img src="/img/ewm.jpg"/></div>
  <div class="version">版本号：2.0.0</div>
  <div class="copyright">湖南明亮信息科技有限公司<br />Copyright© Hunan bright Mdt InfoTech Co.,Ltd<br />AllRights Reserved</div>
</div>
</div>
</div>
</script>

<script type="text/html" id="tpl_kefu">
<div class="page">
<div class="page__bd">
<div id="kefulist" class="weui-cells" style="margin-top:10px;">            
</div>
</div>
</div>
</script>



<script type="text/html" id="tpl_charge_money">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_form">
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">充值金额</label></div>
    <div class="weui-cell__bd">
      <input id="chargemoney" class="weui-input" type="text" placeholder="请输入充值金额(元)" style="text-align:right;" onkeyup="Update_ChargeMoney(this)">
    </div>
  </div>
</div>
<div class='title1 <%=config.ShouXuFei>0?"":"hidden" %>'>实付金额&nbsp;&nbsp;<font class="font1">¥</font><font class="font2">0.00</font></div>
<div class="button">
    <a href="javascript:Open_WXPay()" class="weui-btn weui-btn_primary">充值</a>
</div>
<div class='tip <%=config.ShouXuFei>0?"":"hidden" %>'><%=uinfo.EndDate>=DateTime.Now?"会员":"非会员" %>在线充值收<font class="font3"><%=(config.ShouXuFei/100).ToString("0.00") %></font>%手续费</div>
</div>
</div>
</script>

<script type="text/html" id="tpl_handle">
<div class="page">
<div class="page__bd">
    <div class="personlist">       
        <div class="list">数据加载中...</div>
    </div>
</div>
</div>
</script>
<div id="systemimg" class="weui-popup__container popup-bottom">
      <div class="weui-popup__overlay"></div>
      <div class="weui-popup__modal">
        <div class="toolbar">
          <div class="toolbar-inner">
            <a href="javascript:;" class="picker-button close-popup">关闭</a>
            <h1 class="title">标题</h1>
          </div>
        </div>
        <div class="modal-content">
          <div class="weui-grids" style="margin-bottom:0px;" >
            <a href="javascript:Select_Img('/img/active1.png');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active1.png"></div></a>
            <a href="javascript:Select_Img('/img/active2.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active2.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active3.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active3.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active4.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active4.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active5.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active5.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active6.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active6.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active7.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active7.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active8.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active8.jpg"></div></a>
            <a href="javascript:Select_Img('/img/active9.jpg');" class="weui-grid js_grid" data-id="dialog" style="width:33.33%; padding:0px;"><div class="systemimg"><img src="/img/active9.jpg"></div></a>
          </div>
        </div>
      </div>
    </div>
</html>

